package com.atguigu.gulimall.search.controller;

import com.atguigu.common.to.SkuElasticSearchModleTO;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.search.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/search/sava")
public class ElasticSearchController {

    @Autowired
    private ProductService productService;

    @PostMapping("/product")
    public R productStatusUp(@RequestBody List<SkuElasticSearchModleTO> searchModleTO){
        Boolean result = productService.productStatusUp(searchModleTO);
        if (!result){
            return R.ok();
        }else {
            return R.error();
        }
    }
}
